	@include("user.head")
	<!-- 公共头部 -->

	<div id="content_person">
	<div class="row">
		<div class="col-xs-3">
			@include("user.uc.navigation")
		</div>
		<div class="col-xs-9">
			<div class="panel panel-default">
			  <div class="panel-heading">
			    <h3 class="panel-title">
			    	资讯
			    </h3>
			  </div>
			  <div class="panel-body">
			  	<div class="row">
			  		<div class="col-xs-12">
			  			<button class="btn btn-primary pull_right" id="doAdd">
			  				<i class="fa fa-plus"></i> 发布资讯
			  			</button>
			  		</div>
			  	</div>
			  	<table class="table table-striped table-hover text-center table_marginTop">
				  <thead>
				      <td><b>资讯标题</b></td>
				      <td><b>类型</b></td>
				      <td><b>最近更新时间</b></td>
				      <td><b>操作</b></td>
				  </thead>
				  <tbody>
				  @foreach($data as $value)
				    <tr>
				      <td><%mb_substr($value['title'], 0, 23)%></td>
				      <td>@if ($value["type"] == 0)
						资讯新闻
						@elseif ($value["type"] == 1)
						开发区
						@elseif ($value["type"] == 2)
						机构与业绩
						@elseif ($value["type"] == 3)
						碳排放资讯
						@endif</td>
				      <td><% date('Y-m-d H:i', strtotime($value['create_time'])) %></td>
				      <td>
				      	<button href="#" class="btn btn-primary toDetail" nid="<% $value['id'] %>" title="详情">
				      		<i class="fa fa-eye"></i>
				      	</button>
				      	<button href="#" class="btn btn-primary doEdit" nid="<% $value['id'] %>" title="编辑">
				      		<i class="fa fa-pencil-square-o"></i>
				      	</button>
				      	<button href="#" class="btn btn-primary doDelete" nid="<% $value['id'] %>" title="删除">
				      		<i class="fa fa-trash-o"></i>
				      	</button>
				      </td>
				    </tr>
				    @endforeach
				  </tbody>
				</table>
				<div class="row text-center">
					@if(isset($presenter) && $presenter)
					<?php echo $presenter->render(); ?>
					@endif
				</div>
			  </div>
			</div>
		</div>
	</div>
	</div>

	<!-- 公共底部 -->
	@include("user.footer")
	@include("user.common")
	<!-- 公共底部 -->

</body>
<script type="text/javascript">
$(".toDetail").click(function(){
	nid = $(this).attr('nid');
	window.location.href="<%url('information/detail?nid=')%>"+nid;

})

$("#doAdd").click(function(){
	window.location.href="add_news";
})

$(".doEdit").click(function(){
	var nid = $(this).attr('nid');
	window.location.href="edit_news?nid="+nid;
})

$(".doDelete").click(function(){
	nid = $(this).attr('nid');

	confirm('','确定要删除吗?', 'warning', function(data){
		if(data == 1){
			$.post("<% url('uc/delete_news') %>", {
				nid : nid
			}, function(data){
				if(data.success){
					window.location.reload();
				}
			})
		}
	})

})

</script>
</html>